import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 引入mint
import './plugins/vant.js'
// 引入全局样式
import '../style/Global.css'
import axios from 'axios'
import store from './vuex/store'
import { Toast } from 'vant'
Vue.config.productionTip = false
// 配置请求的跟路径
axios.defaults.baseURL = 'https://api-hmugo-web.itheima.net/api/public/v1'
Vue.prototype.$http = axios
Vue.prototype.$message = Toast
Vue.config.productionTip = false
// 在请求开始时增加进度条
axios.interceptors.request.use(config => {
  if (config.url !== '/goods/search') {
    store.commit('showLoading')
  }
  return config
})

// 响应成功 时取消进度条
axios.interceptors.response.use(config => {
  store.commit('hideLoading')
  return config
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
